
import Component from 'vue-class-component';
import Vue from 'vue';
import DateUtils from '@/utils/DateUtils';
import Header from '@/utils/Header';
import help from './help.md';
import Ajax from '@/utils/Ajax';

@Component({

})
export default class BaiduAudio extends Vue {
    public input = '';

    public created() {

        Header.setHeader({
            title: '百度语音',
            desp: '',
            help,
        });
    }
    public onTransfer() {
        //
        const arr = this.input.split('\n');

        for (const a of arr) {
            if (a) {
                const aLink = document.createElement('a');
                aLink.href = `/api/baidu/text2audio/?text=${a}`;
                aLink.download = `${a}.mp3`;
                aLink.click();
            }
        }
    }

}
